/*
 * @Descripttion:
 * @version:
 * @Author: kl2018
 * @Date: 2019-03-14 16:25:36
 * @LastEditors: kl2018
 * @LastEditTime: 2020-06-22 11:08:45
 */
import React, { Component } from 'react';
import { WeaLocaleProvider } from 'ecCom';
import { WeaTableNew } from 'comsMobx';
import { inject, observer } from 'mobx-react';

const { getLabel } = WeaLocaleProvider;
import * as Util from '../../util/getUrlParams';

const WeaTable = WeaTableNew.WeaTable;
@inject('recPostDocUnitStore')
@observer
class RecPostDocUnitComponent extends Component {
  componentDidMount() {
    const { recPostDocUnitStore } = this.props;

    const receiveUnitId = Util.getQueryString('receiveUnitId');
    if (receiveUnitId != null) {
      recPostDocUnitStore.setReceiveUnitId(receiveUnitId);
    }

    recPostDocUnitStore.getCondition();
  }

  render() {
    const { recPostDocUnitStore } = this.props;
    return (
      <div className="recPostUnitunit">
        {recPostDocUnitStore.form.render()}
        <WeaTable ecId={`${this && this.props && this.props.ecId || ''}_WeaTable@2wnt7v`}
          title={getLabel(126532, '收发文员')}
          comsWeaTableStore={recPostDocUnitStore.tableStore}
          pageSizeOptions={[10]}
        />
      </div>
    );
  }

  removeDialog() {
    const recPostUnitunit = parent.document.getElementsByClassName('recPostUnitunit')[0];
    const iframe = parent.document.getElementById('recPostUnitunit');
    iframe.parentNode.removeChild(iframe);
    recPostUnitunit.parentNode.removeChild(recPostUnitunit);
  }
}
export default RecPostDocUnitComponent;
